<!--重点排查-->
<template>
  <div id="superselectiveExamination">
    <van-tabs
      v-model="active"
      color="dodgerblue"
      line-width="80px"
      background="#eee"
      title-active-color="dodgerblue"
      line-height="4px"
      @click="handlegoto"
    >
      <van-tab title="农房抽查">
        <div class="superselectiveExamination-nfcc">
          <div style="margin-top: 10px">
            <van-search
              v-model="value"
              style="border-radius: 10px; height: 44px"
              background="#f7f8fa"
              placeholder="请输入搜索关键词"
              @search="serachData"
            />
          </div>
          <div class="superselectiveExamination-middle1" v-if="ListData.length > 0">
            <ul
              v-for="(item, index) in ListData"
              :key="index"
              @click="handleAdd(item)"
              class="superselectiveExamination-middle"
            >
            <!-- <li class="superselectiveExamination-middle2" v-if="item.masterName&&(item.houseType == 1)">
                户主姓名：{{ item.masterName }}
              </li>
               <li class="superselectiveExamination-middle2" v-else>
                产权单位名称：{{ item.cqdwmc }}
              </li> -->
              <li class="superselectiveExamination-middle3">
                保存状态：{{ item.saveStatus == "0" ? "未提交" : "已提交" }}
                <span
                  >初判结论：{{
                    item.firstResult == "1"
                      ? "房屋基本安全"
                      : item.firstResult == "2"
                      ? "潜在危险房屋"
                      : "危险房屋"
                  }}</span
                >
              </li>
              <li class="superselectiveExamination-middle4">
                房屋用途：{{
                  item.houseUse == "6" ? "用作生产经营" : "其他自建房"
                }}
                <span
                  >抽查结果：{{
                    item.checkResult == "0"
                      ? "相符"
                      : item.checkResult == "1"
                      ? "基本相符"
                      : "不相符"
                  }}</span
                >
              </li>
            </ul>
          </div>
          <div
            v-else
            style="height: 80vh; text-align: center; padding-top: 20vh"
          >
            <div style="margin-bottom: 10px">
              <img
                src="https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/DSF/50.png"
              />
            </div>
            <div>暂无数据</div>
          </div>
          <div class="superselectiveExamination-footer" v-if="ISShow">
            <van-button color="dodgerblue" block @click="handleAdd"
              >新增</van-button
            >
          </div>
        </div>
      </van-tab>
      <van-tab title="经营性自建房">
        <div class="superselectiveExamination-nfcc">
          <div style="margin-top: 10px">
            <van-search
              v-model="value"
              style="border-radius: 10px; height: 44px"
              background="#f7f8fa"
              placeholder="请输入搜索关键词"
              @search="serachData"
            />
          </div>
          <div class="superselectiveExamination-middle1" v-if="ListData.length > 0">
            <ul
              v-for="(item, index) in ListData"
              :key="index"
              @click="handleAdd(item)"
              class="superselectiveExamination-middle"
            >
          <!-- <li class="superselectiveExamination-middle2" v-if="item.masterName&&(item.houseType == 1)">
                户主姓名：{{ item.masterName }}
              </li>
               <li class="superselectiveExamination-middle2" v-else>
                产权单位名称：{{ item.cqdwmc }}
              </li> -->
              <li class="superselectiveExamination-middle3">
                保存状态：{{ item.saveStatus == "0" ? "未提交" : "已提交" }}
                <span
                  >初判结论：{{
                    item.firstResult == "1"
                      ? "房屋基本安全"
                      : item.firstResult == "2"
                      ? "潜在危险房屋"
                      : "危险房屋"
                  }}</span
                >
              </li>
              <li class="superselectiveExamination-middle4">
                房屋用途：{{
                  item.houseUse == "6" ? "用作生产经营" : "其他自建房"
                }}
                <span
                  >抽查结果：{{
                    item.checkResult == "0"
                      ? "相符"
                      : item.checkResult == "1"
                      ? "基本相符"
                      : "不相符"
                  }}</span
                >
              </li>
            </ul>
          </div>
          <div
            v-else
            style="height: 80vh; text-align: center; padding-top: 20vh"
          >
            <div style="margin-bottom: 10px">
              <img
                src="https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/DSF/50.png"
              />
            </div>
            <div>暂无数据</div>
          </div>
          <div class="superselectiveExamination-footer" v-if="ISShow">
            <van-button color="dodgerblue" block @click="handleAdd"
              >新增</van-button
            >
          </div>
        </div>
      </van-tab>
      <van-tab title="其他自建房">
        <div class="superselectiveExamination-nfcc">
          <div style="margin-top: 10px">
            <van-search
              v-model="value"
              style="border-radius: 10px; height: 44px"
              background="#f7f8fa"
              placeholder="请输入搜索关键词"
              @search="serachData"
            />
          </div>
          <div class="superselectiveExamination-middle1" v-if="ListData.length > 0">
            <ul
              v-for="(item, index) in ListData"
              :key="index"
              @click="handleAdd(item)"
              class="superselectiveExamination-middle"
            >
              <!-- <li class="superselectiveExamination-middle2" v-if="item.masterName&&(item.houseType == 1)">
                户主姓名：{{ item.masterName }}
              </li>
               <li class="superselectiveExamination-middle2" v-else>
                产权单位名称：{{ item.cqdwmc }}
              </li> -->
              <li class="superselectiveExamination-middle3">
                保存状态：{{ item.saveStatus == "0" ? "未提交" : "已提交" }}
                <span
                  >初判结论：{{
                    item.firstResult == "1"
                      ? "房屋基本安全"
                      : item.firstResult == "2"
                      ? "潜在危险房屋"
                      : "危险房屋"
                  }}</span
                >
              </li>
              <li class="superselectiveExamination-middle4">
                房屋用途：{{
                  item.houseUse == "6" ? "用作生产经营" : "其他自建房"
                }}
                <span
                  >抽查结果：{{
                    item.checkResult == "0"
                      ? "相符"
                      : item.checkResult == "1"
                      ? "基本相符"
                      : "不相符"
                  }}</span
                >
              </li>
            </ul>
          </div>
          <div
            v-else
            style="height: 80vh; text-align: center; padding-top: 20vh"
          >
            <div style="margin-bottom: 10px">
              <img
                src="https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/DSF/50.png"
              />
            </div>
            <div>暂无数据</div>
          </div>
          <div class="superselectiveExamination-footer" v-if="ISShow">
            <van-button color="dodgerblue" block @click="handleAdd"
              >新增</van-button
            >
          </div>
        </div>
      </van-tab>
    </van-tabs>
  </div>
</template>
<script>
import dd from "gdt-jsapi";
import { houseCheckSupervisionFwCheckPage } from "../../../utils/api";
export default {
  data() {
    return {
      active: "0",
      value: "",
      ISShow: true,
      cityCode: "",
      ListData: [],
    };
  },
  methods: {
    handleAdd(data) {
      this.$router.push({
        path: "/farmhouseInspector",
        query: {
          data: JSON.stringify(data),
        },
      });
    },
    serachData: async function () {
      this.handlegoto();
    },
    handlegoto: async function () {
      let parmes = {
        cityCode: this.cityCode,
        masterName: this.value,
        pageNo: 1,
        pageSize: 100000,
        roleType: window.sessionStorage.getItem("citycodeRoleD"),
      };
      if (
        window.sessionStorage.getItem("citycodeRoleD") == "0" &&
        window.sessionStorage.getItem("SelectCityD") == "1"
      ) {
        parmes.roleType = 1;
      } else if (
        window.sessionStorage.getItem("citycodeRoleD") == "0" &&
        window.sessionStorage.getItem("SelectCityD") == "2"
      ) {
        parmes.roleType = 2;
      } else if (
        window.sessionStorage.getItem("citycodeRoleD") == "1" &&
        window.sessionStorage.getItem("SelectCityD") == "2"
      ) {
        parmes.roleType = 2;
      }
      if (this.active == "0") {
        var res = await houseCheckSupervisionFwCheckPage(parmes);
      } else if (this.active == "1") {
        parmes.houseUse = 6;
        var res = await houseCheckSupervisionFwCheckPage(parmes);
      } else {
        parmes.houseUse = 7;
        var res = await houseCheckSupervisionFwCheckPage(parmes);
      }
      if (res.data.data.pageList == null) {
        this.ListData = [];
      } else {
        this.ListData = res.data.data.pageList;
      }
    },
    getData: async function () {
      let parmes = {
        cityCode: this.cityCode,
        masterName: "",
        pageNo: 1,
        pageSize: 100000,
        roleType: window.sessionStorage.getItem("citycodeRoleD"),
      };
      if (
        window.sessionStorage.getItem("citycodeRoleD") == "0" &&
        window.sessionStorage.getItem("SelectCityD") == "1"
      ) {
        parmes.roleType = 1;
      } else if (
        window.sessionStorage.getItem("citycodeRoleD") == "0" &&
        window.sessionStorage.getItem("SelectCityD") == "2"
      ) {
        parmes.roleType = 2;
      } else if (
        window.sessionStorage.getItem("citycodeRoleD") == "1" &&
        window.sessionStorage.getItem("SelectCityD") == "2"
      ) {
        parmes.roleType = 2;
      }
      const res = await houseCheckSupervisionFwCheckPage(parmes);
      this.ListData = res.data.data.pageList;
    },
  },
  mounted() {
    if (
      (window.sessionStorage.getItem("citycodeRoleD") == "0" &&
        window.sessionStorage.getItem("SelectCityD") == "1") ||
      (window.sessionStorage.getItem("citycodeRoleD") == "0" &&
        window.sessionStorage.getItem("SelectCityD") == "2") ||
      (window.sessionStorage.getItem("citycodeRoleD") == "1" &&
        window.sessionStorage.getItem("SelectCityD") == "2")
    ) {
      this.ISShow = false;
    } else {
      this.ISShow = true;
    }
    this.cityCode = this.$route.query.data;
    this.getData();
    dd.ready(function () {
      dd.setTitle({
        title: "新增抽查",
      })
        .then((res) => {})
        .catch((err) => {
          console.error(err);
        });
    });
  },
};
</script>
<style lang="scss" scoped >
#superselectiveExamination {
  height: 100vh;
  overflow: auto;
  background: #eee;
  width: 100vw;
  font-family: "Helvetica Neue", Helvetica, STHeiTi, sans-serif;
  font-size: 18px;
  padding: 6px 10px;
  .superselectiveExamination-footer {
    width: 99%;
    margin-top: 4px;
    margin: 0 auto;
    padding-top: 12px;
  }
  .superselectiveExamination-middle1 {
    height: 80vh;
    overflow-y: auto;
    .superselectiveExamination-middle {
      background-color: #fff;
      border-radius: 10px;
      padding: 8px 10px;
      width: 98%;
      margin: 0 auto;
      margin-top: 14px;
      .superselectiveExamination-middle2 {
        font-size: 18px;
        font-weight: 1000;
        color: black;
        line-height: 36px;
      }
      .superselectiveExamination-middle3 {
        font-size: 14px;
        color: #aaa;
        line-height: 24px;
        span {
          float: right;
          // padding-left: 4vw;
        }
      }
      .superselectiveExamination-middle4 {
        font-size: 14px;
        color: #aaa;
        line-height: 24px;
        span {
          float: right;
          // padding-left: 4vw;
        }
      }
    }
  }
}
</style>
<style>
#superselectiveExamination .van-tab {
  font-size: 18px;
}
</style>
